﻿using System;
using System.Collections.Generic;
using Kaiser.Models;
using Kaiser.Modules.CMS.Models;
using Kaiser.Modules.CMS.Services;
using Kaiser.Modules.CMS.Services.Impl;
using Kaiser.Repositories.iBatis;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Kaiser.Test.Modules
{
    [TestClass()]
    [DeploymentItem(@"Kaiser.Site\Maps", "Maps")]
    [DeploymentItem(@"Kaiser.Site\Configs", "Configs")]
    public class CmsTest
    {
        private ICMSManageService _icmsManageService;
        /// <summary>
        ///Delete 的测试
        ///</summary>
        [TestMethod()]
        public void AddContent()
        {
            try
            {
                ICMSManageService service = new CMSManageService(new CMSRepositories());
                var model = new ContentInput();
                // model.Id =  

                model.ContentTitle = "Test001";
                model.ContentDetail = "内容描述";
                model.CreateTime = DateTime.Now;

                var list = new List<CategoryContentInput>();
                list.Add(new CategoryContentInput() { });
                service.InsertContent(model, list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            Assert.Inconclusive("无法验证不返回值的方法。");
        }

        /// <summary>
        ///get 的测试
        ///</summary>
        [TestMethod()]
        public void GetContent()
        {
            try
            {
                ICMSManageService service = new CMSManageService(new CMSRepositories());
                var id = "10124";
                service.GetContent(id);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            Assert.Inconclusive("无法验证不返回值的方法。");
        }



        /// <summary>
        ///get 的测试
        ///</summary>
        [TestMethod()]
        public void GetTreeFunction()
        {
            try
            {
                ICMSManageService service = new CMSManageService(new CMSRepositories());

                var search = new CategorySearch(); 
                PagingInfo pageinfo = new PagingInfo(); 
                //IList<OrderBase> expected = null; 
                pageinfo.Size = 10;
                pageinfo.Index = 0;
                pageinfo.SkipTop = 5;
                service.CategoryTreeList(search, pageinfo);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            Assert.Inconclusive("无法验证不返回值的方法。");
        }
    }
}
